package com.ruoyi.model.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;
import java.util.List;

/**
 * 模型训练任务对象 train_task
 * 
 * @author ruoyi
 * @date 2025-03-10
 */
public class TrainTask extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** 训练任务ID */
    @Excel(name = "训练任务ID")
    private Long id;

    /** 训练任务名称 */
    @Excel(name = "训练任务名称")
    private String name;

    /** 关联的模型ID */
    @Excel(name = "关联的模型ID")
    private Long modelId;

    /** 训练数据文件 */
    @Excel(name = "训练数据文件")
    private String trainFile;

    /** 训练参数(JSON格式) */
    @Excel(name = "训练参数(JSON格式)")
    private String trainParams;

    /** 训练状态(pending/running/completed/failed) */
    @Excel(name = "训练状态", readConverterExp = "pending=待训练,running=训练中,completed=已完成,failed=训练失败")
    private String status;

    /** 开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date startTime;

    /** 结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date endTime;

    /** 训练结果文件 */
    @Excel(name = "训练结果文件")
    private String resultFile;

    /** 错误信息 */
    @Excel(name = "错误信息")
    private String errorMsg;

    /** 模型信息 */
    private List<Model> modelList;

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setModelId(Long modelId) {
        this.modelId = modelId;
    }

    public Long getModelId() {
        return modelId;
    }

    public void setTrainFile(String trainFile) {
        this.trainFile = trainFile;
    }

    public String getTrainFile() {
        return trainFile;
    }

    public void setTrainParams(String trainParams) {
        this.trainParams = trainParams;
    }

    public String getTrainParams() {
        return trainParams;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getStatus() {
        return status;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setResultFile(String resultFile) {
        this.resultFile = resultFile;
    }

    public String getResultFile() {
        return resultFile;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public List<Model> getModelList() {
        return modelList;
    }

    public void setModelList(List<Model> modelList) {
        this.modelList = modelList;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("modelId", getModelId())
                .append("trainFile", getTrainFile())
                .append("trainParams", getTrainParams())
                .append("status", getStatus())
                .append("startTime", getStartTime())
                .append("endTime", getEndTime())
                .append("resultFile", getResultFile())
                .append("errorMsg", getErrorMsg())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .append("modelList", getModelList())
                .toString();
    }
}
